package com.tgy.service;

import org.apache.dubbo.config.annotation.Reference;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/***
 * @ClassName: UserService
 * @Description:
 * @Auther: 送一一块二向箔
 * @Date: 19:31 2021/12/26
 * @version : V1.0
 */
@Component//放到容器中
public class UserService {

    @Reference(version = "1.0.0")//远程引用指定的服务，他会按照全类名进行匹配，看谁给注册中心注册了这个全类名
    TicketService ticketService;//创建一个与提供者一样的接口

    @Reference(version = "1.0.0")
    TgyService tgyService;

    public void bugTicket(){
        String ticket = ticketService.getTicket();
        System.out.println("在注册中心买到"+ticket);
    }

    public void bugTicket2(){
        String ticket = tgyService.getTicket();
        System.out.println("在tgy注册中心买到"+ticket);
    }


}
